<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
    <div id="app">
        <h1>这是登录页面</h1>
        <form rel="formName"  method="post" action="/login">
            <label for="username">账号：</label>
            <input id="username" name="username" type="text">
            <lable for="password">密码：</lable>
            <input id="password" name="password" type="password">
        </form>
        <button onclick="login()">登录</button>
    </div>


</body>
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
<script>
    // let vm=new Vue({
    //     el:"#app",
    //     data() {
    //         return {};
    //     },
    //     methods: {}
    // })

    login=function(){
        data={
            "username":document.getElementById("username").value,
            "password":document.getElementById("password").value
        }
        axios.post('/login',JSON.stringify(data),{
            headers:{
                "content-type":"application/json"
            }
        }).then(function(res){
            console.log(res.data)
        }).catch(function(err){
            console.log(err)
        })
    }
</script>
</html>